function e(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.ocr = exports.chooseImage = void 0;

var t = e(require("../../utils/api-code")), o = e(require("../../utils/util")), r = e(require("../../utils/api"));

exports.chooseImage = function(e) {
    return new Promise(function(t, o) {
        wx.chooseImage({
            count: 1,
            sizeType: [ "compressed" ],
            sourceType: [ e ],
            success: function(e) {
                t(e.tempFilePaths[0]);
            },
            fail: o
        });
    });
}, exports.ocr = function(e) {
    return wx.showLoading({
        title: "智能识别中...",
        mask: !0
    }), new Promise(function(i, s) {
        r.default.weappcard.ocrbusinesscard({
            filePath: e
        }).then(function(e) {
            var o = e.code, r = e.data, s = e.message;
            if (o !== t.default.SUCCESS) return Promise.reject(s);
            wx.hideLoading(), i(r);
        }).catch(function(e) {
            s(), wx.hideLoading(), o.default.qAlert(e || "识别图片失败", "识别失败");
        });
    });
};